package com.jumper.cwolf.leetcode;

import java.util.HashMap;

/**
 * 描述：
 * 1006. 笨阶乘
 * @author cwolf
 * @version 1.0
 * @date 2021/4/1 14:44
 */
public class Code41 {


    public static int firstMissingPositive(int[] nums) {
        if(nums.length==0){
            return 1;
        }
        int[] news = new int[nums.length+1];
        for(int i=0;i<nums.length;i++){
            int n = nums[i];
            if(n<0||n>nums.length){
                continue;
            }
           news[n] = 1;
        }

        for(int i=1;i<news.length;i++){
            int n = news[i];
           if(n==0){
               return i;
           }
        }
        return news.length;
    }
    public static void main(String[] args) {
        System.out.println(Code41.firstMissingPositive(new int[]{
1
        }));
    }


}
